package io.github.lee.jel.ui.main

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import io.github.lee.jel.ui.main.home.HomeFragment

//private val fragmentMap = mutableMapOf(
//    0 to HomeFragment.newInstance()
//)

class MainPageAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
    override fun getItemCount(): Int = 1

    override fun createFragment(position: Int): Fragment =
//        fragmentMap[position] ?: throw IndexOutOfBoundsException()
        when (position) {
            0 -> HomeFragment.newInstance()
            else -> throw IndexOutOfBoundsException()
        }

}